using AutoMapper;
using Pay.DTO;
using Pay.IService;
using Pay.Core;
using Pay.Data;

namespace Pay.Service.AutoMapper {
	public class LogisticsListMapper : IStartupDto {
		private IMapperConfigurationExpression _cfg;
		public LogisticsListMapper(IMapperConfigurationExpression cfg) {
			_cfg = cfg;
		}
		public void Execute() {
			Create();
		}
        protected virtual void Create()
        {
            _cfg.CreateMap<LogisticsList, logistics_list_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.high, src => src.MapFrom(c => c.High))
                .ForMember(dest => dest.length, src => src.MapFrom(c => c.Length))
                .ForMember(dest => dest.width, src => src.MapFrom(c => c.Width))
                .ForMember(dest => dest.payinfoids, src => src.MapFrom(c => c.PayinfoIds))

               .ForMember(dest => dest.statuss, src => src.MapFrom(c => c.Status))
               .ForMember(dest => dest.flightno, src => src.MapFrom(c => c.FlightNO))
                 .ForMember(dest => dest.board_name, src => src.MapFrom(c => c.BoardName))

              
                .ForMember(dest => dest.board_no, src => src.MapFrom(c => c.BoardNO))
                 .ForMember(dest => dest.parentid, src => src.MapFrom(c => c.ParentId))
                .ForMember(dest => dest.create_time, src => src.MapFrom(c => c.CreateTime.ToDateTime()))
                .ForMember(dest => dest.type, src => src.MapFrom(c => c.Type))
                .ForMember(dest => dest.statuss, src => src.MapFrom(c => c.Status))
                .ForMember(dest => dest.postalno, src => src.MapFrom(c => c.PostalNO));
                ;



            _cfg.CreateMap<logistics_list_dto, LogisticsList>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.High, src => src.MapFrom(c => c.high))
                .ForMember(dest => dest.Length, src => src.MapFrom(c => c.length))
                .ForMember(dest => dest.Width, src => src.MapFrom(c => c.width))
                 .ForMember(dest => dest.FlightNO, src => src.MapFrom(c => c.flightno))
                .ForMember(dest => dest.PayinfoIds, src => src.MapFrom(c => c.payinfoids))

                .ForMember(dest => dest.ParentId, src => src.MapFrom(c => c.parentid))
               .ForMember(dest => dest.Status, src => src.MapFrom(c => c.statuss))
                 .ForMember(dest => dest.BoardName, src => src.MapFrom(c => c.board_name))

              
                .ForMember(dest => dest.BoardNO, src => src.MapFrom(c => c.board_no))
                .ForMember(dest => dest.CreateTime, src => src.MapFrom(c => c.create_time.ToUnix()))
                .ForMember(dest => dest.Type, src => src.MapFrom(c => c.type))
                .ForMember(dest => dest.Status, src => src.MapFrom(c => c.statuss))
                .ForMember(dest => dest.PostalNO, src => src.MapFrom(c => c.postalno));
        }
	}
}
